<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>设计调查</title>
		<link rel="stylesheet" type="text/css" href='<s:url value="/styles.css" />'>
	</head>
	<body>
		<s:include value="/header.jsp" />
		<s:set var="sId" value="currSurvey.id" />
		<table>
				<tr>
					<td colspan="2" class="tdWhiteLine"></td>
				</tr>
				<tr>
					<td colspan="2" class="tdHeader">设计调查</td>
				</tr>
				<tr>
					<td colspan="2" class="tdWhiteLine"></td>
				</tr>
				<tr>
					<td class="tdSHeaderL">
						<!-- 调查标题 -->
						<s:if test="photoExist()">
							<img src='<s:url value="%{currSurvey.logoPhotoPath}" />' height="25" width="50">
						</s:if>
						<img src="/lsn_surveypark/upload/kk.jpg" width="50" height="25">
						<s:property value="currSurvey.title" />
					</td>
					<td class="tdSHeaderR" nowrap="nowrap">
						<s:a action="SurveyAction_toAddLogoPage"><s:param name="sid" value="#sId" />增加Logo</s:a>&nbsp;
						<s:a action="SurveyAction_editSurvey"><s:param name="sid" value="#sId" />编辑调查</s:a>&nbsp;
						<s:a action="PageAction_addPage"><s:param name="sid" value="#sId"/>增加页</s:a>&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: left;vertical-align: top;">
						<table>
							<tr>
								<td width="30px"></td>
								<td width="*">
									<table>
										<s:iterator var="p" value="currSurvey.pages">
										<s:set var="pId" value="#p.id" />
										<tr>
											<td>
												<table>
													<tr>
														<td class="tdPHeaderL"><s:property value="#p.title" /></td>
														<td class="tdPHeaderR">
															<s:a action="PageAction_editPage"><s:param name="sid" value="#sId"/><s:param name="pid" value="#pId"/>编辑页标题</s:a>&nbsp;
															<s:a action="MoveOrCopyPageAction_toSelectTargetPage"><s:param name="srcPid" value="#pId" />移动/复制页</s:a>&nbsp;
															<s:a action="QuestionAction_toSelectQuestionType"><s:param name="sid" value="#sId" /><s:param name="pid" value="#pId" />增加问题</s:a>&nbsp;
															<s:a action="PageAction_deletePage"><s:param name="sid" value="#sId" /><s:param name="pid" value="#pId" />删除页</s:a>&nbsp;
														</td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td>
												<table>
													<tr>
														<td width="30px"></td>
														<td width="*">
															<table>
																<tr>
																	<td>
																		<table>
																			<s:iterator var="q" value="#p.questions">
																			<s:set var="qId" value="#q.id" />
																			<tr>
																				<td class="tdQHeaderL"><s:property value="#q.title" /></td>
																				<td class="tdQHeaderR">
																					<s:a action="QuestionAction_editQuestion"><s:param name="sid" value="#sId"/><s:param name="pid" value="#pId"/><s:param name="qid" value="#qId"/>编辑问题</s:a>&nbsp;
																					<s:a action="QuestionAction_deleteQuestion"><s:param name="sid" value="#sId"/><s:param name="qid" value="#qId"/>删除问题</s:a>&nbsp;
																				</td>
																			</tr>
																			<tr>
																				<td colspan="2" style="text-align: left;color: black;background-color: white">
																					<s:set var="qtWithOther" value='"0,1,2,3"' />
																					<s:if test='#qtWithOther.indexOf("" + #q.questionType) > -1'>
																					<s:iterator var="option" value="#q.questionOptionArr" status="itStatus">
																						<s:if test="#q.questionType == 0">
																							<input type="radio" name='q<s:property value="#qId" />' value='<s:property value="#itStatus.index" />'><s:property value="#option" />
																						</s:if>
																						<s:elseif test="#q.questionType == 1">
																							<input type="radio" name='q<s:property value="#qId" />' value='<s:property value="#itStatus.index" />'><s:property value="#option" /><br>
																						</s:elseif>
																						<s:elseif test="#q.questionType == 2">
																							<input type="checkbox" name='q<s:property value="#qId" />' value='<s:property value="#itStatus.index" />'><s:property value="#option" />
																						</s:elseif>
																						<s:elseif test="#q.questionType == 3">
																							<input type="checkbox" name='q<s:property value="#qId" />' value='<s:property value="#itStatus.index" />'><s:property value="#option" /><br>
																						</s:elseif>
																					</s:iterator>
																					</s:if>
																					<s:if test="#q.other == true">
																						<input type='<s:property value="#q.questionType < 2?'radio':'checkbox'" />' name='q<s:property value="#qId" />' value="other">其它
																						<s:if test="#q.otherStyle == 1">
																							<input type="text" name='q<s:property value="#qId" />other' class="text">
																						</s:if>
																						<s:elseif test="#q.otherStyle == 2">
																							<select name='q<s:property value="#qId" />other'>
																								<!-- 迭代下拉选项数组 -->
																								<s:iterator var="otherSelectOption" value="#q.otherSelectOptionArr" status="otherSelectStatus">
																									<option value='<s:property value="#otherSelectStatus.index" />'><s:property value="#otherSelectOption"/></option>
																								</s:iterator>
																							</select>
																						</s:elseif>
																					</s:if>
																					
																					<s:if test="#q.questionType == 4">
																						<select name='q<s:property value="#qId" />'>
																							<s:iterator var="selectOption" value="#q.questionOptionArr" status="ddlb_index">
																								<option value='<s:property value="#ddlb_index.index" />'><s:property value="#selectOption" /></option>
																							</s:iterator>
																						</select>
																					</s:if>
																					
																					<s:if test="#q.questionType == 5">
																						<input type="text" name='q<s:property value="#qId" />' class="text">
																					</s:if>
																					<!-- 处理矩阵式题型 -->
																					<s:set var="qtMatrix" value='"6,7,8"' />
																					<s:if test='#qtMatrix.indexOf("" + #q.questionType) > -1'>
																						<table>
																							<tr>
																								<td></td>
																								<s:iterator var="colLabel" value="#q.matrixColTitleArr">
																									<td><s:property value="#colLabel" /></td>
																								</s:iterator>
																							</tr>
																							<s:iterator var="rowLabel" value="#q.matrixRowTitleArr" status="rowStatus">
																								<tr>
																									<td><s:property value="#rowLabel" /></td>
																									<s:iterator var="colLabel" value="#q.matrixColTitleArr" status="colStatus">
																										<td>
																											<s:if test="#q.questionType == 6">
																												<input type="radio" name='q<s:property value="#qId+'_'+#rowStatus.index" />' value='<s:property value="#rowSt.index + '_' + #colStatus.index" />'>
																											</s:if>
																											<s:elseif test="#q.questionType == 7">
																												<input type="checkbox" name='q<s:property value="#qId" />' value='<s:property value="#rowStatus.index+'_'+#colStatus.index" />'>
																											</s:elseif>
																											<s:elseif test="#q.questionType == 8">
																												<select name='q<s:property value="#qId" />'>
																													<s:iterator var="selectOption" value="#q.matrixSelectOptionArr" status="optionStatus">
																														<option value='<s:property value="#rowStatus.index+'_'+#colStatus.index+'_'+#optionStatus.index" />'><s:property value="#selectOption" /></option>
																													</s:iterator>
																												</select>
																											</s:elseif>
																										</td>
																									</s:iterator>
																								</tr>
																							</s:iterator>
																						</table>
																					</s:if>
																				</td>
																			</tr>
																			</s:iterator>
																		</table>
																	</td>
																</tr>
															</table>
														</td>
													</tr>
												</table>
											</td>
										</tr>
										</s:iterator>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
	</body>
</html>